
<% content_for :head do -%>
  <%#= javascript_include_tag 'admin/merchandise_product' %>
<% end %>


<% content_for :below_body do -%>
  <script>
    //Hadean.AdminMerchandiseProductForm.initialize(<%= @variant.id %>);
  </script>
<% end %>

  <%= error_messages_for 'variant' %>

<fieldset id="admin-product-names">
<div class='clear'></div>
  <div>
    <%= form.label :sku %>
  </div>
  <div>
    <%= form.text_field :sku %>
  </div>

<div class='clear'></div>
  <div>
    <%= form.label :price %>
  </div>
  <div>
    <%= form.text_field :price %>
  </div>
<div class='clear'></div>
  <div>
    <%= form.label :cost %>
  </div>
  <div>
    <%= form.text_field :cost %>
  </div>

<div class='clear'></div>
  <div>
    <%= form.label :master %>
  </div>
  <div>
    <%= form.check_box :master %>
  </div>

</fieldset>

<fieldset id="admin-product-properties">
  <legend>Properties</legend>

  <div id="variant_properties" class='last'>
    <% @product.properties.each do |property| %>
      <div  id='variant_<%= property.id %>'
            class="variant_form left last">
        <%= form.fields_for :variant_properties,
                            property.variant_properties.find_or_initialize_by(variant_id: @variant.id) do |variant_property_form|%>
          <div class='left'>
            <%= property.display_name %>:
          </div>
          Primary?: <%= variant_property_form.check_box  :primary %> <br/>
          <%= variant_property_form.hidden_field  :property_id %>
          Description: <%= variant_property_form.text_field    :description %><br/>
        <% end %>
      </div>
    <% end %>
  </div>

</fieldset>
